import { reqGetSearchInfo } from '@/api';

const state = {
	searchList: {}
};
const mutations = {
	GETSEARCHLIST(state, data) {
		state.searchList = data;
	}
};
const actions = {
	async getSearchList({ commit }, params) {
		let res = await reqGetSearchInfo(params);
		if (res.code === 200) {
			commit('GETSEARCHLIST', res.data);
		}
	}
};
const getters = {
	// 商品列表
	goodsList(state) {
		return state.searchList.goodsList || [];
	},
	// 商品属性
	attrsList(state) {
		return state.searchList.attrsList;
	},
	// 品牌
	trademarkList(state) {
		return state.searchList.trademarkList;
	}
};
export default {
	state,
	mutations,
	actions,
	getters
};
